﻿using SmartPlant.Core;
using SmartPlant.Core.Mvvm;
using SmartPlant.Model.Biz;
using SmartPlant.Modules.Base.ViewModels;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Docking;

namespace SmartPlant.Modules.Base.Views
{
    /// <summary>
    /// UserManage.xaml 的交互逻辑
    /// </summary>
    public partial class UserManage : RadDocumentPane, IPaneModel, ICanClosedDocumentView
    {
        public UserManage()
        {
            InitializeComponent();
        }

        public DockState Position => DockState.DockedLeft;

        private void radGridView_ColumnDisplayIndexChanged(object sender, GridViewColumnEventArgs e)
        {
            Console.WriteLine(e.Column.Header.ToString());

        }

        private void RadDocumentPane_Unloaded(object sender, System.Windows.RoutedEventArgs e)
        {

        }

        private void MyRadGridView_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            if (DataContext is UserManageViewModel viewModel)
            {
                viewModel.SelectedItems.Clear();
                foreach (var item in gridView.SelectedItems.Cast<IntoolsUser>())
                {
                    viewModel.SelectedItems.Add(item);
                }
            }
        }
    }
}
